package tool.zyk.factory;

import tool.zyk.connect.ServerConnection;
import tool.zyk.connect.ServerConnectionFactory;
import tool.zyk.connect.SimpleRpcInstance;

import java.util.Collections;
import java.util.List;

/**
 * @author zhangyongkang
 * @time 2024/2/19 14:39
 * @description
 */
public class NacosServerConnectionFactory implements ServerConnectionFactory {
    @Override
    public ServerConnection getConnection() {
        return new ServerConnection() {
            @Override
            public String registerInstance(SimpleRpcInstance instance) {
                return null;
            }

            @Override
            public boolean removeInstance(String id) {
                return false;
            }

            @Override
            public List<SimpleRpcInstance> selectList(String instanceName, String clusterName) {
                SimpleRpcInstance simpleRpcInstance = new SimpleRpcInstance();
                simpleRpcInstance.setIp("localhost");
                simpleRpcInstance.setPort(9092);
                return Collections.singletonList(simpleRpcInstance);
            }
        };
    }
}
